USE [PaltopDatabase]
GO

/****** Object:  Table [dbo].[FileExtention]    Script Date: 11/16/2011 19:33:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[FileExtention](
	[FileExtentionID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [varchar](10) NULL,
	[Description] [varchar](max) NULL,
	[JSFunction] [varchar](max) NULL,
PRIMARY KEY CLUSTERED 
(
	[FileExtentionID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO




USE [PaltopDatabase]
GO

/****** Object:  Table [dbo].[FileSecurityInfo]    Script Date: 11/16/2011 19:33:17 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[FileSecurityInfo](
	[FileSecurityInfoID] [int] IDENTITY(1,1) NOT NULL,
	[Access] [char](2) NULL,
	[AccountID] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[FileSecurityInfoID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[FileSecurityInfo]  WITH CHECK ADD  CONSTRAINT [FK_FileSecurityInfo_Account] FOREIGN KEY([AccountID])
REFERENCES [dbo].[Account] ([AccountID])
GO

ALTER TABLE [dbo].[FileSecurityInfo] CHECK CONSTRAINT [FK_FileSecurityInfo_Account]
GO




USE [PaltopDatabase]
GO

/****** Object:  Table [dbo].[FileInfo]    Script Date: 11/16/2011 19:31:55 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[FileInfo](
	[FileInfoID] [int] IDENTITY(1,1) NOT NULL,
	[CreationDate] [datetime] NULL,
	[Title] [varchar](255) NULL,
	[RootFolderID] [int] NULL,
	[Size] [int] NULL,
	[ParentID] [int] NULL,
	[SecurityInfoID] [int] NULL,
	[FileExtentionID] [int] NULL,
	[FileFlag] [bit] NULL,
	[IsRoot] [bit] NULL,
	[Address] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[FileInfoID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[FileInfo]  WITH CHECK ADD  CONSTRAINT [FK_FileInfo_FileExtention] FOREIGN KEY([FileExtentionID])
REFERENCES [dbo].[FileExtention] ([FileExtentionID])
GO

ALTER TABLE [dbo].[FileInfo] CHECK CONSTRAINT [FK_FileInfo_FileExtention]
GO

ALTER TABLE [dbo].[FileInfo] ADD  DEFAULT ((1)) FOR [FileFlag]
GO

ALTER TABLE [dbo].[FileInfo] ADD  DEFAULT ((0)) FOR [IsRoot]
GO


USE [PaltopDatabase]
GO

/****** Object:  Table [dbo].[FileInfo_FileSecurityInfo]    Script Date: 11/16/2011 19:32:11 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[FileInfo_FileSecurityInfo](
	[FileSecurityInfoID] [int] NOT NULL,
	[FileInfoID] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[FileSecurityInfoID] ASC,
	[FileInfoID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[FileInfo_FileSecurityInfo]  WITH CHECK ADD  CONSTRAINT [FK_FileInfo_FileSecurityInfo_FileInfo] FOREIGN KEY([FileInfoID])
REFERENCES [dbo].[FileInfo] ([FileInfoID])
GO

ALTER TABLE [dbo].[FileInfo_FileSecurityInfo] CHECK CONSTRAINT [FK_FileInfo_FileSecurityInfo_FileInfo]
GO

ALTER TABLE [dbo].[FileInfo_FileSecurityInfo]  WITH CHECK ADD  CONSTRAINT [FKFileInfo_F828642] FOREIGN KEY([FileSecurityInfoID])
REFERENCES [dbo].[FileSecurityInfo] ([FileSecurityInfoID])
GO

ALTER TABLE [dbo].[FileInfo_FileSecurityInfo] CHECK CONSTRAINT [FKFileInfo_F828642]
GO

